<%@include file="template/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>
            ${website} || 
            <c:choose>
                <c:when test="${categoryedit!=null}">Edit</c:when>
                <c:otherwise>Add</c:otherwise>
            </c:choose>category
        </title>
        ${stylesheet}
        ${jquery}
    </head>
    <body>
        <div class="container">
            <%@include file="template/header.jsp" %>
            <div class="content">
                <h1>Manage categories</h1>
                <h3>
                    <c:choose>
                        <c:when test="${categoryedit!=null}">Edit</c:when>
                        <c:otherwise>Add</c:otherwise>
                    </c:choose>category
                </h3>
                    <c:choose>
                        <c:when test="${categoryedit!=null}">
                             <form action="ManageCategory" method="POST" name="categoryedit">
                            <input type="hidden" name="formoption" value="categoryedit"/>
                        </c:when>
                        <c:otherwise>
                             <form action="ManageCategory" method="POST" name="categoryadd">
                            <input type="hidden" name="formoption" value="categoryadd"/>
                        </c:otherwise>
                    </c:choose>
                    <label for="name">Name</label> <input type="text" name="name" id="name" value="${categoryedit.name}${param.name}" required/>
                    <span class="error">${error.name}</span>
                    <br />
                    <label for="description">Description</label> <textarea name="description" id="description" required>${categoryedit.description}${param.description}</textarea>
                    <br />
                    <input type="hidden" name="categoryid" value="${categoryedit.id}"/>
                    <label>&nbsp;</label> <input type="submit" value="Save category" />                    
                </form>
            </div>
            <%@include file="template/footer.jsp" %>
        </div>
    </body>
</html>
